package com.soboot.gateway.config;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.client.reactive.ReactorResourceFactory;

/**
 * @Author:
 * @createTime: 2022年09月21日 09:11:04
 * @version:
 * @Description:
 * @Copyright:
 */
@Slf4j
@Configuration
public class ReactNettyConfiguration {

    @Value("${reactor.netty.worker-count}")
    private String workerCount;

    @Bean
    public ReactorResourceFactory reactorClientResourceFactory() {
        System.setProperty("reactor.netty.ioWorkerCount", workerCount);
        log.info("worker线程数={}",workerCount);
        return new ReactorResourceFactory();
    }
}
